﻿// CReportDlg.cpp: 实现文件
//

#include "stdafx.h"
#include "CK103.h"
#include "CReportDlg.h"
#include "afxdialogex.h"
#include "Report/CReportFactory.h"


// CReportDlg 对话框

IMPLEMENT_DYNAMIC(CReportDlg, CMyDialog)

CReportDlg::CReportDlg(CWnd* pParent /*=nullptr*/)
	: CMyDialog(IDD_REPORT_DLG, pParent),
	m_nRptSel(-1)
{

}

CReportDlg::~CReportDlg()
{
}

void CReportDlg::DoDataExchange(CDataExchange* pDX)
{
	CMyDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_REPORT, m_cmbReport);
	DDX_Control(pDX, IDOK, m_btnOk);
	DDX_Control(pDX, IDCANCEL, m_btnCancel);
}


BEGIN_MESSAGE_MAP(CReportDlg, CMyDialog)
	ON_BN_CLICKED(IDOK, &CReportDlg::OnBnClickedOk)
END_MESSAGE_MAP()


// CReportDlg 消息处理程序


BOOL CReportDlg::OnInitDialog()
{
	CMyDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	CReportFactory::m_ArrReportInfo[0].strReportName = g_LoadString(L"MSG30");
	CReportFactory::m_ArrReportInfo[1].strReportName = g_LoadString(L"MSG31");

	for (size_t i = 0; i < CReportFactory::m_ArrReportInfo.size(); i++)
	{
		m_cmbReport.AddString(CReportFactory::m_ArrReportInfo[i].strReportName);
	}

	if (m_nRptSel >= (int)(CReportFactory::m_ArrReportInfo.size()))
	{
		m_cmbReport.SetCurSel(0);
		m_nRptSel = 0;
	}
	else
	{
		m_cmbReport.SetCurSel(m_nRptSel);
	}

	this->SetDlgBkColor(RGB(51, 51, 51), RGB(255, 255, 255));
	this->SetDlgBorderColor(RGB(51, 51, 51), 2);
	this->SetStaticColor(RGB(0, 0, 0), RGB(255, 255, 255));
	
	//设置对话框上控件的语言文字
	g_SetDialogStrings(this, IDD);

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void CReportDlg::OnBnClickedOk()
{
	UpdateData();
	m_nRptSel = m_cmbReport.GetCurSel();
	CMyDialog::OnOK();
}

